import java.util.Scanner;
import java.util.Arrays;

class CustomizedArray{
	private int len;
	private int volume;
	private int[] array;
	
	public CustomizedArray(int volume){
		this.volume = volume;
		array = new int[this.volume];
		len = 0;
	}

	public void add(int element){
		if((len + 1) * 1.0 / volume >= 0.8){
			this.volume = (int)(this.volume * 1.5);
			int[] newArray = new int[this.volume];
			System.arraycopy(this.array, 0, newArray, 0, this.len);
			this.array = newArray;
		}
		this.array[len] = element;
		this.len += 1;
	}

	public void show(){
		System.out.println(Arrays.toString(this.array));
		System.out.println("长度为：" + this.len + "\n容量为：" + this.volume);
	}

	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入初始数组容量：");
		int v = scanner.nextInt();
		CustomizedArray arr = new CustomizedArray(v);
		System.out.println("当前数组为：");
		arr.show();
		while(true){
			System.out.println("请输入需要加入的元素：");
			int e = scanner.nextInt();
			arr.add(e);
			arr.show();
		}
	}
}